Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amm liquidity pool #256

Merged
merged 78 commits into from
Mar 7, 2023
Merged

Amm liquidity pool #256

merged 78 commits into from
Mar 7, 2023

Conversation

danijelthales
Copy link
Contributor

@danijelthales danijelthales commented Jan 17, 2023

Release steps:

  1. Pause amm and parlay amm trading -- done
  2. Turn off sport exerciser bot. --done
  3. Deploy Liquidity pool and Liquidity Pool mastercopy -- done
  4. Set onlyWhitelistedStakers allowed in LiquidityPool -- done
  5. Set mastercopy in liquidity pool -- done
  6. Deploy new AMM Utils -- done
  7. Upgrade SportsAMM -- done
  8. upgrade odds obtainer -- done
  9. upgrade consumer -- done
  10. Set new utils in SportsAMM -- done
  11. Set LiquidityPool in SportsAMM -- done
  12. Set staking and staking multiplier in LPPool -- done
  13. Makes sure that round length is 7 days in LPPool -- done
  14. Deploy default liquidity provider contract and seed it with sUSD -- done
  15. add LP contract to whitelisted vaults in staking thales so it can update volume -- done
  16. send all options and sUSD out of Amm contract to EOA -- done
  17. deposit at least 100k from a treasury EOA or directly from treasury -- done
  18. Upgrade staking contract -- done
  19. Set LP address in staking contract -- done
  20. configure new fee variables (SB, min_spread and parlayAMM pays SportsAMM) -- done
  21. set pDAO as owner of LP pool contract -- done
  22. start pool -- done
  23. unpause and run final test -- done
  24. implement a new bot that calls exercise on LP pool whenever there are markets to exerise

@danijelthales
Copy link
Contributor Author

@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Patch coverage: 80.98% and project coverage change: -0.65 ⚠️

Comparison is base (1c2ca46) 85.66% compared to head (ec5adac) 85.02%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #256      +/-   ##
==========================================
- Coverage   85.66%   85.02%   -0.65%     
==========================================
  Files          71       74       +3     
  Lines        2163     2203      +40     
  Branches     1092     1115      +23     
==========================================
+ Hits         1853     1873      +20     
- Misses        310      330      +20     
Impacted Files Coverage Δ
contracts/AMM/SafeBox.sol 100.00% <ø> (ø)
...Markets/LiquidityPool/DefaultLiquidityProvider.sol 0.00% <0.00%> (ø)
contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol 98.52% <ø> (+1.26%) ⬆️
contracts/SportMarkets/Parlay/ParlayVerifier.sol 96.66% <ø> (ø)
...tracts/SportMarkets/Rundown/TherundownConsumer.sol 99.00% <ø> (ø)
contracts/EscrowAndStaking/StakingThales.sol 86.20% <66.66%> (-0.64%) ⬇️
...ntracts/SportMarkets/Rundown/GamesOddsObtainer.sol 89.06% <78.57%> (-1.08%) ⬇️
...ortMarkets/LiquidityPool/SportAMMLiquidityPool.sol 80.41% <80.41%> (ø)
contracts/SportMarkets/SportsAMM.sol 92.59% <86.95%> (+3.50%) ⬆️
contracts/SportMarkets/SportsAMMUtils.sol 84.78% <88.88%> (-7.33%) ⬇️
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.


/// @notice Deposit funds from user into pool for the next round
/// @param amount Value to be deposited
function deposit(uint amount) external canDeposit(amount) nonReentrant whenNotPaused {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although is cleaner, modifier used only once might produce higher contract size

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its a reused approach from the vaults code

kirilaa
kirilaa previously approved these changes Jan 18, 2023
Copy link
Collaborator

@kirilaa kirilaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me.
There is also a room for the borrowing staked amount.

… amm-liquidity-pool

# Conflicts:
#	contracts/SportMarkets/SportsAMM.sol
@danijelthales danijelthales changed the base branch from feat/double-chance-markets to main February 27, 2023 13:18
@danijelthales danijelthales dismissed kirilaa’s stale review February 27, 2023 13:18

The base branch was changed.

/// @notice Return the end time of the passed round
/// @param round number
/// @return uint the end time of the given round
function getRoundEndTime(uint round) public view returns (uint) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to uint _round since round is a state variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done thx

/// @notice Return the start time of the passed round
/// @param round number
/// @return uint the start time of the given round
function getRoundStartTime(uint round) public view returns (uint) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to uint _round since round is a state variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

);
}

uint nextRound = round + 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable, delete if not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

uint _roundStartTime,
uint _roundEndTime
) external {
require(!initialized, "Ranged Market already initialized");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done thx

/// @param sUSDAmount amount to get for mint
function commitTrade(address market, uint sUSDAmount) external nonReentrant whenNotPaused onlyAMM {
require(started, "Pool has not started");
require(sUSDAmount > 0, "Can't commit a zero trade");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add require ! zero address for market market

i know it will fail due to ISportPositionalMarket marketContract = ISportPositionalMarket(market); in getMarketRound

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trust assumed as onlyAMM can call it

/* ========== STATE VARIABLES ========== */

ISportsAMM public sportsAMM;
IERC20Upgradeable public sUSD;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are only using sUSD? and on ARBI it is USDC right? 1e18 both? if not that case was covered right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there isnt much work to support USDC, I'll try to implement it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added USDC support

@grujawork grujawork merged commit 9a57a1f into main Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants